//
//  ClientMainViewController.h
//  aigo
//
//  Created by Tai Truong on 11/20/12.
//  Copyright (c) 2012 AIGO. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import <MapKit/MapKit.h>
#import "APIRequester.h"
#import "AIGOMapAnnotationObject.h"
#import "AIGOMapAnnotationView.h"
#import "PersonDataManager.h"
#import "TouchedGestureRecognizer.h"
#import "Define.h"
#import "RequestPopupView.h"

#define INT_CLIENT_PAGE_SIZE_INDEX                                          100
#define TIMER_AUTOMATION_UPDATE_CLIENT                                      30

typedef enum {
    enumClientMainStatus_Invalid,
    enumClientMainStatus_PickUpThisDriver,
    enumClientMainStatus_RequestClosestDriver,
    enumClientMainStatus_RequestThisDriver,
    enumClientMainStatus_WaitingForDriverArrival,
    enumClientMainStatus_GettingCar,
    enumClientMainStatus_BeginTrip,
    enumClientMainStatus_FinishTrip
}enumClientMainStatus;

typedef enum {
    enumClientSeatsStatus_Invalid,
    enumClientSeatsStatus_4Seats,
    enumClientSeatsStatus_8Seats,
    enumClientSeatsStatus_All
}enumClientSeatsStatus;

@interface ClientMainViewController : UIViewController <APIRequesterProtocol, CLLocationManagerDelegate, MKMapViewDelegate, TouchedGestureRecognizerProtocol, RequestPopupViewDelegate> {
    APIRequester                            *_APIRequester;
    APIRequester                            *_APIRequesterAutomation;
    
    CFAbsoluteTime                          _updateDriverTimer;
    enumClientSeatsStatus                   _seatsStatus;
    
    CGRect                                  _frameListButton1;
    CGRect                                  _frameListButton2;
    CGRect                                  _frameListButton3;
    CGRect                                  _frameListButton4;
    CGRect                                  _frameListButton5;
    
    PersonNodeData                          *_selectedDriver;
    
    CLLocationCoordinate2D                  _centralPoint;
    float                                   _radiusMeters;
    
    BOOL                                    _isRequestAtFirstTime;
    
    TouchedGestureRecognizer                *_touchedGestureRecognizer;
    
    NSMutableDictionary                     *_remoteNotification;
}
@property (weak, nonatomic) IBOutlet MKMapView *mapViewClient;
@property (weak, nonatomic) IBOutlet UILabel *lblClientAddress;
@property (strong, nonatomic) IBOutlet UIView *viewListPopup;
@property (weak, nonatomic) IBOutlet UIButton *btnRequestClosestDriver;
@property (weak, nonatomic) IBOutlet UIButton *btnRequestThisDriver;
@property (weak, nonatomic) IBOutlet UIButton *btnCancelTheRequest;
@property (weak, nonatomic) IBOutlet UIButton *btnCallYourDriver;
@property (weak, nonatomic) IBOutlet UIButton *btnCancelThisTransaction;
@property (weak, nonatomic) IBOutlet UIButton *btnFinishTrip;
@property (weak, nonatomic) IBOutlet UILabel *lblDriverName;
@property (weak, nonatomic) IBOutlet UILabel *lblDriverVendor;
@property (weak, nonatomic) IBOutlet UILabel *lblDriverLicense;
@property (weak, nonatomic) IBOutlet UILabel *lblDriverCapacity;
@property (weak, nonatomic) IBOutlet UIView *viewDriverInterface;
@property (weak, nonatomic) IBOutlet UIView *viewDistanceInterface;
@property (weak, nonatomic) IBOutlet UIButton *btn8Seats;
@property (weak, nonatomic) IBOutlet UIButton *btn4Seats;
@property (weak, nonatomic) IBOutlet UIView *viewMapInterface;
- (IBAction)touchUpInsideSetting:(id)sender;
- (IBAction)touchUpInsideList:(id)sender;
- (IBAction)touchUpInsideHideList:(id)sender;
- (IBAction)touchUpInsideSeatsButton:(id)sender;
- (IBAction)touchUpInsideListButton:(id)sender;
- (void)didReceiveRemoteNotification:(NSDictionary*)userInfo andNotificationType:(enumRemoveNotificationType)type;

@end
